/**
 * @Description:
 * @author LDY
 * @date 2020
 */
import network from './network';

interface List {
  pageSize: number;
}
// 方法装饰器日志输出
function log(target: object, name: string,  descriptor: PropertyDescriptor ): PropertyDescriptor {
  const oldValue  = descriptor.value ;
  descriptor.value = function() {
    const args = [...arguments];
    console.log(`Calling ${name} with`, args);
    return oldValue.apply(this, args);
  };
  return descriptor;
}
// 类装饰器
function factory(value: object) {
  return function(target: object) : void {
    console.log(target);
  };
}

class API {
  static getReviewList({ pageSize }: List ): number {
   return pageSize;
  }
  @log
  static setList<T>(type: T): T {
    return type;
  }
}

const s = <List> {};
s.pageSize = 10;
// console.log(s);
// API.getReviewList({pageSize: 10 });
API.setList<string>('type');

export default API;